import axios from "axios";
const request = axios.create({
  baseURL: "http://192.168.67.91:1337", // url = base url + request url
  timeout: 5000, // request timeout
});


// 获取房产列表
export function getPropertyList(params) {
  return request({
    url: `/properties`,
    params,
  });
}
// 新增房产
export function addProperty(data) {
  return request({
    url: "/properties",
    method: "post",
    data,
  });
}
// 获取到分类（渲染分类下拉框）
export function classify() {
  return request({
    url: "/categories",
  });
}
// 获取全部经纪(渲染经济下拉框)
export function agents() {
  return request({
    url: "/agents",
  });
}
// 获取指定房产
export function getEditHouse(id) {
  return request({
    url: "/properties/" + id,
  });
}

// 编辑房产
export function editHouse(data) {
  return request({
    url: "/properties/" + data.id,
    method: "put",
    data,
  });
}
// 删除房产
export function delHouse(id) {
  return request({
    url: "/properties/" + id,
    method: "DELETE",
  });
}
// 获取房产数量
export function getHouseNum() {
  return request({
    url: "/properties/count",
  });
}
// 获取房产（搜索）
export function search(params) {
  // console.log(62, params)
  return request({
    url: "/properties",
    params,
  });
}
